--[[ 编码: WMS-03-02 名称: 容器-修改前 作者:HAN 日期:2025-1-29 级别: 项目 函数: BeforeDataObjCreate 功能: N_LOC_TYPE, N_TYPE 根据字典获取这些值的说明 更改记录: --]] wms_base = require( "wms_base" ) function BeforeDataObjModify ( strLuaDEID ) local nRet, strRetInfo -- step1 获取当前货位绑定表的信息,获取 货位号,容器编号 nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_LOC_TYPE", "N_TYPE" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end local obj_attrs = json.decode( strRetInfo ) local loc_type = lua.StrToNumber( obj_attrs[1].value ) -- 货位类型 local area_type = lua.StrToNumber( obj_attrs[2].value ) -- 库区类型 if ( loc_type == "" ) then loc_type = 1 end -- 取货位类型信息 local str_loc_type = wms_base.GetDictItemName( strLuaDEID, "WMS_LocationType", loc_type ) -- 取库区类型信息 local str_type = wms_base.GetDictItemName( strLuaDEID, "WMS_AreaType", area_type ) -- 设置货位类型信息 local attr_value = {} attr_value[1] = lua.KeyValueObj( "S_LOC_TYPE", str_loc_type ) attr_value[2] = lua.KeyValueObj( "S_TYPE", str_type ) nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置库区信息失败! "..strRetInfo ) end end